home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_02_04 / 2n04038a < prev    next >
Text File  |  1991-02-16  |  1KB  |  43 lines

  1.  
  2. ;
  3. ; Critical Error handler routine
  4. ;
  5.  
  6. XCPTN    PROC   FAR            ; PROC must be FAR (to make RET FAR)
  7.          STI
  8.          CMP    DI,0002H       ; Drive not ready?
  9.          JE     NEWHND         ; then goto new code
  10. OLDHND:  DEC    SP             ; Allocate
  11.          DEC    SP             ; 2 words on stack
  12.          DEC    SP             ; for use by
  13.          DEC    SP             ; FAR RET
  14.          PUSH   BP             ; BP will be used
  15.          MOV    BP,SP          ; to compute position of those 2 words
  16.          PUSH   AX
  17.          PUSH   DS
  18.          MOV    AX,SEG DGROUP
  19.          MOV    DS,AX
  20.          MOV    AX,WORD PTR DS:[OLDVCT+02H] ; Get segment from old vector
  21.          MOV    WORD PTR SS:[BP+04H],AX     ; Put it in reserved word
  22.          MOV    AX,WORD PTR DS:[OLDVCT]     ; Get offset from old vector
  23.          MOV    WORD PTR SS:[BP+02H],AX     ; Put it in reserved word
  24.          POP    DS
  25.          POP    AX
  26.          POP    BP
  27.                 ; Stack is now as it was on entry
  28.                 ; except for 2 words
  29.                 ; that will be popped and used by RET
  30.          CLI
  31.          RET              ; FAR RET used as FAR goto
  32. NEWHND:
  33.          ...
  34.  
  35.          IRET
  36. XCPTN    ENDP
  37.  
  38.          ...
  39.  
  40. _BSS     SEGMENT BYTE PUBLIC 'BSS'
  41. OLDVCT   DD    ?          ; Address of the old handler
  42. _BSS     ENDS
  43.